Electronic devices, such as mobile phones, tablet computers, usually employ a touch screen as the input/output mechanism. In order to control the electronic device more conveniently, one or more mechanical keys are also installed at a sidewall or other places of the electronic devices.